package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class ButtonCounter extends JFrame {

	private JButton button = new JButton("1");

	public ButtonCounter(String title) {
		super(title);
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				int count = Integer.parseInt(button.getText());
				button.setText(new Integer(++count).toString());
			}
		});
		add(button);
		setSize(100,100);
		setVisible(true);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
new ButtonCounter("button");
	}

}
